package com.niiwoo.civet.trade.enums;

import com.niiwoo.tripod.provider.exception.NoSuchEnumValueException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 标的申请流程总概表-流程执行状态：0-执行中，1-成功 2-失败'
 */
@Getter
@AllArgsConstructor
public enum ProjectFlowExecuteStatusEnum {

	EXECUTING((byte)0, "执行中"),
	SUCCESS((byte)1, "成功"),
	FAIL((byte)2, "失败")
	;

	private Byte status;
	private String desc;

	public static ProjectFlowExecuteStatusEnum enumOf(Byte status) {
		for (ProjectFlowExecuteStatusEnum statusEnum : values()) {
			if (statusEnum.status.equals(status)) {
				return statusEnum;
			}
		}
		throw new NoSuchEnumValueException("ProjectFlowExecuteStatusEnum:" + status);
	}

	public static String getDesc(Byte status){
		for (ProjectFlowExecuteStatusEnum statusEnum : values()) {
			if (statusEnum.status.equals(status)) {
				return statusEnum.desc;
			}
		}
		return null;
	}
}
